# +--------------------------
# | User: zq                -
# | Version: python3.7      -
# | Time: 2020-03-10 20:06                
# +--------------------------
from peewee import *

db = MySQLDatabase("spider_meetlove", host="localhost", port=3306, user="root", password="root")


class BaseModel(Model):
    class Meta:
        database = db


# 文章列表
class List(BaseModel):
    id = IntegerField(primary_key=True)  # 文章id
    title = CharField()  # 文章标题
    picname = CharField()  # 文章缩略图地址
    desc = CharField()  # 文章简介


# 文章内容表
class Article(BaseModel):
    arc_id = IntegerField()  # 文章id
    create_time = DateField()  # 创建时间
    yuedu_nums = IntegerField(default=0)  # 阅读数
    content = TextField()  # 内容


if __name__ == "__main__":
    db.create_tables([List, Article])
